package dao

import (
	"gorm.io/gorm"
	"time"
)

type Exam struct {
	gorm.Model
	Type          int       `json:"type" gorm:"type:tinyint(1);default:1;common:1-进行中2-已结束"`
	TestPaperName string    `json:"testPaperName" gorm:"type:varchar(100);common:'试卷名称'"`
	PaperCate     string    `json:"paperCate" gorm:"type:varchar(30);common:'试卷分类'"`
	QuestionType  int       `json:"questionType" gorm:"type:tinyint(1);default:1;common:'1-随机2-固定'"`
	CreateTime    time.Time `json:"createTime" gorm:"type:datetime;common:'发布时间'"`
	Num           int       `json:"num" gorm:"type:int(5);common:'试题数量'"`
	Ok            int       `json:"ok" gorm:"type:tinyint(1);common:'1-已发布2-未发布'"`
	UserId        int       `json:"userId" gorm:"type:int(10);common:'发布人'"`
}

func (Exam) TableName() string {
	return "c_exam"
}

type ExamPaper struct {
	gorm.Model
	ExamId  int `json:"examId" gorm:"type:int(10);common:'考试编号'"`
	PaperId int `json:"paperId" gorm:"type:int(10);common:'考试试卷编号'"`
}

func (ExamPaper) TableName() string {
	return "c_exam_paper"
}

type ExamStudent struct {
	gorm.Model
	ExamId int `json:"examId" gorm:"type:int(10);common:'考试编号'"`
	UserId int `json:"userId" gorm:"type:int(10);common:'考生编号'"`
}

func (ExamStudent) TableName() string {
	return "c_exam_student"
}

type ExamBegin struct {
	gorm.Model
	ExamId int     `json:"examId" gorm:"type:int(10);common:'考试编号'"`
	UserId int     `json:"userId" gorm:"type:int(10);common:'考生编号'"`
	Yes    string  `json:"yes" gorm:"type:varchar(255);common:'做题答案'"`
	Scan   float64 `json:"scan" gorm:"type:float(10,2);common:'分数'"`
}

func (ExamBegin) TableName() string {
	return "c_exam_begin"
}

type TestPaper struct {
	gorm.Model
	UserId        int       `json:"userId" gorm:"type:int(10);common:'用户编号'"`
	TestPaperName string    `json:"testPaperName" gorm:"type:varchar(100);common:'试卷名称'"`
	ClassName     string    `json:"className" gorm:"type:varchar(30);common:'试卷分类''"`
	CreateTime    time.Time `json:"createTime" gorm:"datetime;common:'组卷时间'"`
}

func (TestPaper) TableName() string {
	return "c_test_paper"
}

type TestPaperQuestion struct {
	gorm.Model
	TestPaperId int `json:"testPaperId" gorm:"type:int(10);common:'试卷编号'"`
	QuestionId  int `json:"questionId" gorm:"type:int(10);common:'试题编号'"`
}

func (TestPaperQuestion) TableName() string {
	return "c_test_paper_question"
}
